<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>Login Page | Amaze UI Example</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="format-detection" content="telephone=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="alternate icon" type="image/png" href="/Public/vendor/assets/i/favicon.png">
    <link rel="stylesheet" href="/Public/vendor/assets/css/amazeui.min.css"/>
    <style>
        .header {
            text-align: center;
        }

        .header h1 {
            font-size: 200%;
            color: #333;
            margin-top: 30px;
        }
        .login-dafault{
            text-align: center;
        }

        .header p {
            font-size: 14px;
        }
    </style>
</head>
<body>
<div class="header">
    <div class="am-g">
        <h1>Web ide</h1>
        <p>Integrated Development Environment<br/>代码编辑，代码生成，界面设计，调试，编译</p>
    </div>
    <hr/>
</div>
<div class="am-g">
    <div class="am-u-lg-6 am-u-md-8 am-u-sm-centered">
        <h1 class="login-dafault">登录</h1>
        <hr>
        <div class="am-btn-group">
            <a href="#" class="am-btn am-btn-secondary am-btn-sm"><i class="am-icon-github am-icon-sm"></i> Github</a>
            <a href="#" class="am-btn am-btn-success am-btn-sm"><i class="am-icon-google-plus-square am-icon-sm"></i>
                Google+</a>
            <a href="#" class="am-btn am-btn-primary am-btn-sm"><i class="am-icon-stack-overflow am-icon-sm"></i>
                stackOverflow</a>
        </div>
        <br>
        <br>

        <form class="am-form">
            <label>用户名/邮箱/手机号:</label>
            <input type="text"  id="username" placeholder="请输入用户名/邮箱/手机号">
            <br>
            <label for="password">密码:</label>
            <input type="password"  id="password"  placeholder="请输入密码">
            <br>
            <div class="am-form-group">
                <label for="code">验证码:</label>
                <input type="text" id="code" placeholder="请输入验证码">
            </div>

            <div class="am-checkbox">
                <label>
                    <input type="checkbox"> 记住我
                </label>
                <div class="am-form-group">
                    <img src="<?php echo U('User/verify');?>" id="verify" style="cursor: pointer;">
                </div></div>
            <div class="am-cf">
                <input type="submit" name="" value="登 录" class="am-btn am-btn-primary am-btn-sm am-fl submit">
                <a href="<?php echo U('User/password_reset');?>" class="am-btn am-btn-info am-btn-sm am-fr">忘记密码 ^_^?</a>
                <a href="<?php echo U('User/register');?>" class="am-btn am-btn-info am-btn-sm am-fr">没有账号，点我注册 ^_^?</a>
            </div>
        </form>
        <hr>
        <p>© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
    </div>
</div>
<script src="/Public/vendor/assets/js/jquery.min.js"></script>
<script>
    //刷新验证码
    $(function () {
        function set_verify() {
            var src = "<?php echo U('User/verify');?>" + '?' + Math.random();
            $("#verify").attr('src', src); //attr设置值
        }

        set_verify();

        $("#verify").click(function () {
            set_verify();
        })
        $(".submit").click(function() {
            //获取表单的值
            var info = {
                username: $("#username").val(),
                password: $("#password").val(),
                code: $("#code").val(),
            };
            //            console.log(info);return false;
            $.post("<?php echo U('ajax_login');?>",info,function(data){
                if(data.status=1){
                    alert(data.msg);
                    location.href = "<?php echo U('/Admin/Index/index');?>";
                }else{
                    alert(data.msg);
                }

            })
            return false;
        })


    });
</script>
</body>
</html>